package jwdt.xadmin.system.bean;

import java.util.List;

import jwdt.common.util.CacheUtil;

import com.ezerg.db.Jdb;
import com.ezerg.db.annotation.Column;
import com.ezerg.db.annotation.Table;
import com.ezerg.fastjson.annotation.JSONField;

@Table(name="t_dep", keys={"id"}, comment="")
public class TDep implements java.io.Serializable {

	private static final long serialVersionUID = 1L;

	@Column(value="id", comment="")
	private String id;
	
	@Column(value="name", comment="部门名称")
	private String name;
	
	@Column(value="fid", comment="上级ID")
	private Integer fid;
	
	@Column(value="px", comment="排序")
	private Integer px;
	
	@Column(value="zt", comment="状态")
	private Integer zt;
	
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Integer getFid() {
		return fid;
	}
	
	public void setFid(Integer fid) {
		this.fid = fid;
	}
	
	public String getFname() {
		if(this.fid == 0)
			return "";
		TDep d = (TDep)Jdb.get().get(TDep.class, this.fid);
		if(d == null)
			return "";
		return d.getName();
	}
	
	public Integer getPx() {
		return px;
	}

	public void setPx(Integer px) {
		this.px = px;
	}

	public Integer getZt() {
		return zt;
	}
	
	public void setZt(Integer zt) {
		this.zt = zt;
	}
	
	@JSONField(serialize=false)
	@SuppressWarnings("rawtypes")
	public List getChildren() {
		return Jdb.get().query(TDep.class, "fid=? ORDER BY id", new Object[]{this.id}, CacheUtil.C0);
	}

}
